import Vue from 'vue'
import Vuex from 'vuex'
import {carcommond} from '../router/index'

Vue.use(Vuex)
import {mapMutations} from 'vuex'

export default new Vuex.Store({
  state: {
    token:sessionStorage.getItem('token')?sessionStorage.getItem('token'):'',
    isLogin:sessionStorage.getItem('isLogin')?sessionStorage.getItem('isLogin'):false,
    // userinfo:[],
    // count:2
  },
  getters:{
    // getuserinfo(state){
    //   return state.userinfo
    // },
    getisLogin(state){
      return state.isLogin
    },
    getToken(state){
      return state.token
    },
    // getcount(state){
    //   return state.count++
    // }
  },
  mutations: {
    setToken(state,params){
      sessionStorage.setItem('token',params.token)
      sessionStorage.setItem('isLogin',true)
      state.token=params.token
      state.isLogin=true
    } ,
    // setcarcommond(state,params){
    //   state.caraddinfo=params
    // }
    // setuserinfo(state,params){
    //   state.userinfo=params
    // }
  },
  actions: {
    // getcount(state){
    //   state.count++
    //   commit('setcount',count)
    // }
  },
  
  modules: {
  }
})
